// Licensed to the Apache Software Foundation (ASF) under one// or more contributor license agreements. See the NOTICE file// distributed with this work for additional information// regarding copyright ownership. The ASF licenses this file// to you under the Apache License, Version 2.0 (the// "License"); you may not use this file except in compliance// with the License. You may obtain a copy of the License at//// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.// Code generated by the FlatBuffers compiler. DO NOT EDIT.package flatbufimport (flatbuffers)// / Compressed Sparse Fiber (CSF) sparse tensor index.typeSparseTensorIndexCSFstruct { _tab flatbuffers.Table}func ( []byte, flatbuffers.UOffsetT) *SparseTensorIndexCSF { := flatbuffers.GetUOffsetT([:]) := &SparseTensorIndexCSF{} .Init(, +)return}func ( *SparseTensorIndexCSF) ( []byte, flatbuffers.UOffsetT) { ._tab.Bytes = ._tab.Pos = }func ( *SparseTensorIndexCSF) () flatbuffers.Table {return ._tab}// / CSF is a generalization of compressed sparse row (CSR) index.// / See [smith2017knl](http://shaden.io/pub-files/smith2017knl.pdf)// /// / CSF index recursively compresses each dimension of a tensor into a set// / of prefix trees. Each path from a root to leaf forms one tensor// / non-zero index. CSF is implemented with two arrays of buffers and one// / arrays of integers.// /// / For example, let X be a 2x3x4x5 tensor and let it have the following// / 8 non-zero values:// / ```text// / X[0, 0, 0, 1] := 1// / X[0, 0, 0, 2] := 2// / X[0, 1, 0, 0] := 3// / X[0, 1, 0, 2] := 4// / X[0, 1, 1, 0] := 5// / X[1, 1, 1, 0] := 6// / X[1, 1, 1, 1] := 7// / X[1, 1, 1, 2] := 8// / ```// / As a prefix tree this would be represented as:// / ```text// / 0 1// / / \ |// / 0 1 1// / / / \ |// / 0 0 1 1// / /| /| | /| |// / 1 2 0 2 0 0 1 2// / ```// / The type of values in indptrBuffersfunc ( *SparseTensorIndexCSF) ( *Int) *Int { := flatbuffers.UOffsetT(._tab.Offset(4))if != 0 { := ._tab.Indirect( + ._tab.Pos)if == nil { = new(Int) } .Init(._tab.Bytes, )return }returnnil}// / CSF is a generalization of compressed sparse row (CSR) index.// / See [smith2017knl](http://shaden.io/pub-files/smith2017knl.pdf)// /// / CSF index recursively compresses each dimension of a tensor into a set// / of prefix trees. Each path from a root to leaf forms one tensor// / non-zero index. CSF is implemented with two arrays of buffers and one// / arrays of integers.// /// / For example, let X be a 2x3x4x5 tensor and let it have the following// / 8 non-zero values:// / ```text// / X[0, 0, 0, 1] := 1// / X[0, 0, 0, 2] := 2// / X[0, 1, 0, 0] := 3// / X[0, 1, 0, 2] := 4// / X[0, 1, 1, 0] := 5// / X[1, 1, 1, 0] := 6// / X[1, 1, 1, 1] := 7// / X[1, 1, 1, 2] := 8// / ```// / As a prefix tree this would be represented as:// / ```text// / 0 1// / / \ |// / 0 1 1// / / / \ |// / 0 0 1 1// / /| /| | /| |// / 1 2 0 2 0 0 1 2// / ```// / The type of values in indptrBuffers// / indptrBuffers stores the sparsity structure.// / Each two consecutive dimensions in a tensor correspond to a buffer in// / indptrBuffers. A pair of consecutive values at `indptrBuffers[dim][i]`// / and `indptrBuffers[dim][i + 1]` signify a range of nodes in// / `indicesBuffers[dim + 1]` who are children of `indicesBuffers[dim][i]` node.// /// / For example, the indptrBuffers for the above X is:// / ```text// / indptrBuffer(X) = [// / [0, 2, 3],// / [0, 1, 3, 4],// / [0, 2, 4, 5, 8]// / ].// / ```func ( *SparseTensorIndexCSF) ( *Buffer, int) bool { := flatbuffers.UOffsetT(._tab.Offset(6))if != 0 { := ._tab.Vector() += flatbuffers.UOffsetT() * 16 .Init(._tab.Bytes, )returntrue }returnfalse}func ( *SparseTensorIndexCSF) () int { := flatbuffers.UOffsetT(._tab.Offset(6))if != 0 {return ._tab.VectorLen() }return0}// / indptrBuffers stores the sparsity structure.// / Each two consecutive dimensions in a tensor correspond to a buffer in// / indptrBuffers. A pair of consecutive values at `indptrBuffers[dim][i]`// / and `indptrBuffers[dim][i + 1]` signify a range of nodes in// / `indicesBuffers[dim + 1]` who are children of `indicesBuffers[dim][i]` node.// /// / For example, the indptrBuffers for the above X is:// / ```text// / indptrBuffer(X) = [// / [0, 2, 3],// / [0, 1, 3, 4],// / [0, 2, 4, 5, 8]// / ].// / ```// / The type of values in indicesBuffersfunc ( *SparseTensorIndexCSF) ( *Int) *Int { := flatbuffers.UOffsetT(._tab.Offset(8))if != 0 { := ._tab.Indirect( + ._tab.Pos)if == nil { = new(Int) } .Init(._tab.Bytes, )return }returnnil}// / The type of values in indicesBuffers// / indicesBuffers stores values of nodes.// / Each tensor dimension corresponds to a buffer in indicesBuffers.// / For example, the indicesBuffers for the above X is:// / ```text// / indicesBuffer(X) = [// / [0, 1],// / [0, 1, 1],// / [0, 0, 1, 1],// / [1, 2, 0, 2, 0, 0, 1, 2]// / ].// / ```func ( *SparseTensorIndexCSF) ( *Buffer, int) bool { := flatbuffers.UOffsetT(._tab.Offset(10))if != 0 { := ._tab.Vector() += flatbuffers.UOffsetT() * 16 .Init(._tab.Bytes, )returntrue }returnfalse}func ( *SparseTensorIndexCSF) () int { := flatbuffers.UOffsetT(._tab.Offset(10))if != 0 {return ._tab.VectorLen() }return0}// / indicesBuffers stores values of nodes.// / Each tensor dimension corresponds to a buffer in indicesBuffers.// / For example, the indicesBuffers for the above X is:// / ```text// / indicesBuffer(X) = [// / [0, 1],// / [0, 1, 1],// / [0, 0, 1, 1],// / [1, 2, 0, 2, 0, 0, 1, 2]// / ].// / ```// / axisOrder stores the sequence in which dimensions were traversed to// / produce the prefix tree.// / For example, the axisOrder for the above X is:// / ```text// / axisOrder(X) = [0, 1, 2, 3].// / ```func ( *SparseTensorIndexCSF) ( int) int32 { := flatbuffers.UOffsetT(._tab.Offset(12))if != 0 { := ._tab.Vector()return ._tab.GetInt32( + flatbuffers.UOffsetT(*4)) }return0}func ( *SparseTensorIndexCSF) () int { := flatbuffers.UOffsetT(._tab.Offset(12))if != 0 {return ._tab.VectorLen() }return0}// / axisOrder stores the sequence in which dimensions were traversed to// / produce the prefix tree.// / For example, the axisOrder for the above X is:// / ```text// / axisOrder(X) = [0, 1, 2, 3].// / ```func ( *SparseTensorIndexCSF) ( int, int32) bool { := flatbuffers.UOffsetT(._tab.Offset(12))if != 0 { := ._tab.Vector()return ._tab.MutateInt32(+flatbuffers.UOffsetT(*4), ) }returnfalse}func ( *flatbuffers.Builder) { .StartObject(5)}func ( *flatbuffers.Builder, flatbuffers.UOffsetT) { .PrependUOffsetTSlot(0, flatbuffers.UOffsetT(), 0)}func ( *flatbuffers.Builder, flatbuffers.UOffsetT) { .PrependUOffsetTSlot(1, flatbuffers.UOffsetT(), 0)}func ( *flatbuffers.Builder, int) flatbuffers.UOffsetT {return .StartVector(16, , 8)}func ( *flatbuffers.Builder, flatbuffers.UOffsetT) { .PrependUOffsetTSlot(2, flatbuffers.UOffsetT(), 0)}func ( *flatbuffers.Builder, flatbuffers.UOffsetT) { .PrependUOffsetTSlot(3, flatbuffers.UOffsetT(), 0)}func ( *flatbuffers.Builder, int) flatbuffers.UOffsetT {return .StartVector(16, , 8)}func ( *flatbuffers.Builder, flatbuffers.UOffsetT) { .PrependUOffsetTSlot(4, flatbuffers.UOffsetT(), 0)}func ( *flatbuffers.Builder, int) flatbuffers.UOffsetT {return .StartVector(4, , 4)}func ( *flatbuffers.Builder) flatbuffers.UOffsetT {return .EndObject()}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.